#!/usr/bin/env python3
# coding:utf-8
import requests
import json
# server_url = 'http://0.0.0.0:8080/core/task/'
server_url = 'http://0.0.0.0:8090/core/quarter/'


def get_all_quarter_tree():
    data = {'id': 1}
    url = server_url + 'get_tree_all/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(type(r))
    print(r.json())

def add_quarter():
    data = {
        "name":"董事2",
        "description":"让2",
        "code":"JCP222",
        "dis_order":2,
        "create_time": '2018-8-28',
        "department_id":2,
        "parent_id":6,
        "status":1,
    }
    url = server_url + 'add/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(type(r))
    print(r.json())

def edit_quarter():
    data = {
        "id":18,
        "name":"董事4",
        "description":"让2",
        "code":"JC1",
        "dis_order":2,
        "create_time": '2018-8-28',
        "department_id":1,
        "parent_id":7,
        "status":1,
    }
    url = server_url + 'edit/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(type(r))
    print(r.json())

def del_quarter():
    data = {'id': 7}
    url = server_url + 'del/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(type(r))
    print(r.json())

# get_all_quarter_tree()
# add_quarter()
# del_quarter()
edit_quarter()